package com.sinas;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Sinas
 */
public class TimerVitesse extends Thread {
    private boolean sleep = true;
    private int time=0;


    public TimerVitesse()
    {
    }

    public void sleepToi() {
        sleep = true;
    }

    public void reveilleToi() {
        sleep = false;
    }

    public float getTime() {
        return time/10; //passage de time en secondes
    }

    @Override
    public void run() {
        while (true) {
                if(!sleep)
                {
                    time++;
                
                try {
                    Thread.sleep(100); //time est en 10emes de secondes

                    } catch (InterruptedException ex) {
                        Logger.getLogger(TimerVitesse.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            }
        }
}
